home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.8 KB | 77 lines | [TEXT/GEOL] |
- Item 6173538 31-May-90 14:00PDT
-
- From: D4695 Skywalker Sys, Scott Collins,PRT
-
- To: MOOF Rollin, Keith A
- MACAPP.TECH$ MacApp Technical
- MACDTS Macintosh Developer Tech Supt
-
- Sub: Complete Focus Fix (+new bug)
-
- Hello,
-
- This is an update to the Focus and IsShown bugs I posted recently. First,
- the recursive version of TView.IsShown works well and as yet no bad side
- effects have surfaced. Second, the modification to TControl.ContainsMouse does
- have a bad side effect caused by an inconsistancy in MacApp. TCtlMgr objects
- neither use, nor respect the fShown field. Instead they use the routines
- SetCMgrVisibility and IsCMgrVisible. It seems that fShown is typically FALSE
- for such an object, even when it is visible, thus it would fail the
- TControl.ContainsMouse test. (So after installing the new
- TControl.ContainsMouse, none of your scrollbars, for instance, would accept
- mouse clicks anymore.)
-
- One way to fix this problem would be to write a TCtlMgr.Show that did the
- right thing and use it instead (of SetCMgrVisibility), but after examining how
- MacApp uses SetCMgrVisibility, I found that this would be a difficult
- proposition. If the MacApp team wants to enforce consistant use of fShown,
- they can do it; the easy thing for me to do was allow TCtlMgr's to have their
- own way of determining visibility. To reflect this I had to write
- TCtlMgr.IsShown.
-
- Here are the one new and two modified routines I am now using (so far with
- great success). Some of the bugs they fix are: 1) invisible controls in
- dialogs accepting mousedowns and doing things; 2) children of invisible
- controls being asked to draw or handle a mousedown; 3) scrollbars of hidden
- scrollers appearing; 4) your calls to IsShown for an arbitrary view returning
- untrue (true) results.
-
- { -------------------------------------------------- }
- FUNCTION TView.IsShown: BOOLEAN;
- BEGIN
- IsShown := fShown;
- IF fShown & (fSuperView<>NIL) THEN
- IsShown := fSuperView.IsShown;
- END;
-
- { -------------------------------------------------- }
- FUNCTION TControl.ContainsMouse(theMouse: VPoint): BOOLEAN; OVERRIDE;
- VAR
- aRect: Rect;
- BEGIN
- IF IsShown THEN
- BEGIN
- ControlArea(aRect);
- ContainsMouse := PtInRect(VPtToPt(theMouse), aRect);
- END
- ELSE
- ContainsMouse := FALSE;
- END;
-
- { -------------------------------------------------- }
- FUNCTION TCtlMgr.IsShown: BOOLEAN;
- VAR
- shown: Boolean;
- BEGIN
- shown := IsCMgrVisible;
- IF fSuperView <> NIL THEN
- shown := shown & fSuperView.IsShown;
- IsShown := shown;
- END;
-
-
-
- Hope this helps (and thanks Keith)
- -- Scott Collins
-
-